Skip to content

Clone boxed BigInt values in structuredClone - #58211

Open
OskarEichler wants to merge 1 commit into
react:mainfrom
OskarEichler:codex/fix-structured-clone-bigint-wrapper
Open

Clone boxed BigInt values in structuredClone#58211
OskarEichler wants to merge 1 commit into
react:mainfrom
OskarEichler:codex/fix-structured-clone-bigint-wrapper

Conversation

@OskarEichler

@OskarEichler OskarEichler commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary:

The structured-clone polyfill handles boxed Boolean, Number, and String objects but returns a plain empty object for boxed BigInt. Capture the built-in BigInt valueOf, read the internal primitive without user overrides, clone the wrapper through that value, and register it in clone memory.

Fixes #58210.

Changelog:

[GENERAL] [FIXED] - Preserve boxed BigInt values in structuredClone without user coercion.

Test Plan:

  • Exact Hermes baseline failed the BigInt-wrapper assertion.
  • Final regression shadows the source wrapper's valueOf with a throwing function; the clone is distinct, remains a BigInt wrapper, and returns 1n, matching native structuredClone.
  • Fixed focused Fantom suite: 32/32 passed.
  • Fresh yarn flow-check: 0 errors.
  • Targeted ESLint, Prettier, and git diff --check passed.

No UI change; screenshots are not applicable.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 30, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Aug 30, 2026
@OskarEichler
OskarEichler force-pushed the codex/fix-structured-clone-bigint-wrapper branch from 33ad0bd to 58d8a3a Compare August 30, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

structuredClone turns boxed BigInt values into plain objects

1 participant